<%@ page import="com.itheima.domain.Book" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>修改图书</title>
</head>
<body>
	<center>
	<%
	request.setCharacterEncoding("UTF-8");
	Book book = (Book) request.getAttribute("book");
	Integer id = book.getId();
	String name = book.getBookName();
	String author = book.getAuthor();
	String price = book.getPrice();

	if(request.getSession().getAttribute("user") != null) { %>

	
	<div class="container" id="idchange">
		<div class="row clearfix">
			<div class="col-md-12 column">
				<form action="/update/book" method="post" >
					<div class="form-group">
						 <label for="inputEmail" class="col-sm-2 control-label">请输入您要修改后的书名:</label>
						<div class="col-sm-10">
							<input type="hidden"  name="id" value="<%= id %>"/>
							<input class="form-control" id="inputEmail" type="text" name="bookName" value="<%= name %>" />
						</div>
					</div>
					<div class="form-group">
						 <label for="inputPassword" class="col-sm-2 control-label">请输入您修改后的作者:</label>
						<div class="col-sm-10">
							<input class="form-control" id="inputPassword" type="text" name="author" value="<%= author %>"/>
						</div>
					</div>
					<div class="form-group">
						<label for="priceInput"  class="col-sm-2 control-label">请输入您修改后的价格:</label>
						<div class="col-sm-10">
							<input id="priceInput" class="form-control"  type="text" name="price" value="<%= price %>"/>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
							 <button type="submit" class="btn btn-default">提交</button>
						</div>
					</div>
				</form>
				<button class="btn btn-default" id="back1">返回</button>
				<script>
					document.getElementById("back1").addEventListener("click", function () {
						window.location.href = "/allBook";
					});
				</script>
			</div>
		</div>
	</div>
	

	<%} else {%>
	<h1>请登录后再访问此页面</h1>
	<a href="loginOut"><i>返回登陆</i></a>
	<%} %>
	<font color="red" size="2"> ${msg }</font>
	</center>
<script src="js/jquery-1.11.3.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/changebook.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>